Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

importblock: resolve circular import issue #153

Merged
merged 1 commit into from
Jul 16, 2024

Conversation

markmc
Copy link
Contributor

@markmc markmc commented Jul 16, 2024

Fixes #147

importblock uses Pipeline, and the pipeline module defines:

  _block_types = {
    ...
    "ImportBlock": importblock.ImportBlock,

which gives the following error:

src/instructlab/sdg/__init__.py:29: in <module>
    from .importblock import ImportBlock
src/instructlab/sdg/importblock.py:6: in <module>
    from . import pipeline
src/instructlab/sdg/pipeline.py:102: in <module>
    "ImportBlock": importblock.ImportBlock,
E   AttributeError: partially initialized module 'src.instructlab.sdg.importblock' has no attribute 'ImportBlock' (most likely due to a circular import)

This fixes the issue, but it's not very satisfactory, so I've included a FIXME.

Fixes instructlab#147

importblock uses Pipeline, and the pipeline module defines:

  _block_types = {
    ...
    "ImportBlock": importblock.ImportBlock,

which gives the following error:

```
src/instructlab/sdg/__init__.py:29: in <module>
    from .importblock import ImportBlock
src/instructlab/sdg/importblock.py:6: in <module>
    from . import pipeline
src/instructlab/sdg/pipeline.py:102: in <module>
    "ImportBlock": importblock.ImportBlock,
E   AttributeError: partially initialized module 'src.instructlab.sdg.importblock' has no attribute 'ImportBlock' (most likely due to a circular import)
```

This fixes the issue, but it's not very satisfactory, so I've included
a FIXME.

Signed-off-by: Mark McLoughlin <[email protected]>
Copy link
Member

@russellb russellb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm assuming CI passes

@markmc markmc merged commit d6fd987 into instructlab:main Jul 16, 2024
11 checks passed
jwm4 pushed a commit to jwm4/sdg that referenced this pull request Dec 13, 2024
…/dot-github/workflows/rhysd/actionlint-1.7.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unit test job broken by #73
2 participants